home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / pctchnqs / 1990 / number5 / tp6shift.pas < prev    next >
Pascal/Delphi Source File  |  1990-10-19  |  609b  |  15 lines

  1. FUNCTION ShiftDWordRight(Target : LongInt;
  2.                          ShiftBy : Integer) : LongInt;
  3.                          ASSEMBLER;
  4.  
  5. ASM
  6.     MOV DX, Target+2.WORD  { Move high order word into DX }
  7.     MOV AX, Target.WORD    { Move low-order word into AX  }
  8.     MOV CX, ShiftBy        { Move shift count into CX     }
  9.     CLC                    { Clear the carry flag }
  10.   @Shift:                  { Local label! }
  11.     SHR DX,1               { Shift DX rightward }
  12.     RCR AX,1               { Shift AX rightward with carry  }
  13.     LOOP @Shift            { Loop back to @Shift if CX <> 0 }
  14. END;
  15.